import { request } from '@inbiz/utils';

// 获取分类树
export async function getCategoryTree(params: {
  categoryType: number;
  parentId: string;
}): Promise<string> {
  return await request.get(
    `/inbiz/api/services/cms/v${InbizConfig.API_VERSION}/cms/categoryTree/${params.parentId}?categoryType=${params.categoryType}`,
  );
}

// 分页获取图片新闻分类列表，支持搜索条件
export async function getCategoryList(params: {
  categoryType: number;
  categoryName: string;
  pageIndex: number;
  pageSize: number;
}): Promise<string> {
  return await request.get(
    `/inbiz/api/services/cms/v${InbizConfig.API_VERSION}/cms/cmsCategoryList?categoryType=${params.categoryType}&categoryName=${params.categoryName}&pageIndex=${params.pageIndex}&pageSize=${params.pageSize}`,
  );
}
